/**
 * Computes the sum of the first N terms of the sequnce (1/i) 
 */
public class FractionSum {

    public static void main(String[] args) {
        System.out.println("fractionSum(0)       = " + fractionSum(0));
        System.out.println("fractionSum(1)       = " + fractionSum(1));
        System.out.println("fractionSum(2)       = " + fractionSum(2));
        System.out.println("fractionSum(5)       = " + fractionSum(5));
        System.out.println("fractionSum(10)      = " + fractionSum(10));
        System.out.println("fractionSum(25)      = " + fractionSum(25));
        System.out.println("fractionSum(50)      = " + fractionSum(50));
        System.out.println("fractionSum(100)     = " + fractionSum(100));
        System.out.println("fractionSum(1000)    = " + fractionSum(1000));
        System.out.println("fractionSum(10000)   = " + fractionSum(10000));
        System.out.println("fractionSum(100000)  = " + fractionSum(100000));
        System.out.println("fractionSum(1000000) = " + fractionSum(1000000));
    }


    // --------------------------------
    // ----- ENTER YOUR CODE HERE -----
    // --------------------------------
    
    public static double fractionSum(int x) {
        double total = 0;
        for (double i = 1; i <= x; i++) {
            total += (1 / i);
        }
        return total;
    }

    // --------------------------------
    // --------- END USER CODE --------
    // --------------------------------


}
              